package com.applcn.user.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "platform.wxapp")
@Data
public class WxappConfig {

    private String appid;

    private String secret;

    private String grantType;

    private String url;

    public String getJscode2SessionUrl(String jsCode) {
        return new StringBuilder(url).append("?")
                .append("appid=").append(appid).append("&")
                .append("secret=").append(secret).append("&")
                .append("js_code=").append(jsCode).append("&")
                .append("grant_type=").append(grantType).toString();
    }
}
